Skip to content

feat: blob inspect command #1133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 16, 2025
Merged

Conversation

JeyJeyGao
Copy link
Contributor

@JeyJeyGao JeyJeyGao commented Jan 2, 2025

Feat:

  • added notation blob inspect command
  • added signature envelope type for inspect command to be consistent with blob inspect command spec

Fix:

  • removed repeated blob.Cmd()

Fix docs:

  • updated the command spec docs

Refactor:

  • refactor inspect handler related code to be shared by blob inspect handler

Test:

  • added E2E

Output examples
Text format:

/home/jj/download/LICENSE.jws.sig
├── signature algorithm: RSASSA-PSS-SHA-256
├── signature envelope type: application/jose+json
├── signed attributes
│   ├── content type: application/vnd.cncf.notary.payload.v1+json
│   ├── signing scheme: notary.x509
│   └── signing time: Tue Jan  7 08:42:43 2025
├── user defined attributes
│   └── (empty)
├── unsigned attributes
│   ├── signing agent: notation-go/1.3.0+unreleased
│   └── timestamp signature
│       ├── timestamp: [Tue Jan  7 08:42:43 2025, Tue Jan  7 08:42:44 2025]
│       └── certificates
│           ├── SHA256 fingerprint: 36e731cfa9bfd69dafb643809f6dec500902f7197daeaad86ea0159a2268a2b8
│           │   ├── issued to: CN=Microsoft Public RSA Timestamping CA 2020,O=Microsoft Corporation,C=US
│           │   ├── issued by: CN=Microsoft Identity Verification Root Certificate Authority 2020,O=Microsoft Corporation,C=US
│           │   └── expiry: Mon Nov 19 20:42:31 2035
│           └── SHA256 fingerprint: 3403d75002d22e2b8c49a8a113957d9eb225c901b946837fd61ff3ce32c51f65
│               ├── issued to: CN=Microsoft Public RSA Time Stamping Authority,OU=Microsoft America Operations+OU=Thales TSS ESN:45D6-96C5-5E63,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
│               ├── issued by: CN=Microsoft Public RSA Timestamping CA 2020,O=Microsoft Corporation,C=US
│               └── expiry: Sat Feb 15 20:35:56 2025
├── certificates
│   └── SHA256 fingerprint: 3678adce9daa3a82f4f55fd65e0c87c398b3d9bcd5338c06bbf8850df8c6641d
│       ├── issued to: CN=testcert3,O=Notary,L=Seattle,ST=WA,C=US
│       ├── issued by: CN=testcert3,O=Notary,L=Seattle,ST=WA,C=US
│       └── expiry: Wed Jan  8 08:42:24 2025
└── signed artifact
    ├── media type: application/octet-stream
    ├── digest: sha256:c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4
    └── size: 11357

Json format:

{
  "signatureAlgorithm": "RSASSA-PSS-SHA-256",
  "signatureEnvelopeType": "application/jose+json",
  "signedAttributes": {
    "contentType": "application/vnd.cncf.notary.payload.v1+json",
    "signingScheme": "notary.x509",
    "signingTime": "2025-01-07T08:42:43Z"
  },
  "userDefinedAttributes": null,
  "unsignedAttributes": {
    "signingAgent": "notation-go/1.3.0+unreleased",
    "timestampSignature": {
      "timestamp": "[2025-01-07T08:42:43.582Z, 2025-01-07T08:42:44.582Z]",
      "certificates": [
        {
          "SHA256Fingerprint": "36e731cfa9bfd69dafb643809f6dec500902f7197daeaad86ea0159a2268a2b8",
          "issuedTo": "CN=Microsoft Public RSA Timestamping CA 2020,O=Microsoft Corporation,C=US",
          "issuedBy": "CN=Microsoft Identity Verification Root Certificate Authority 2020,O=Microsoft Corporation,C=US",
          "expiry": "2035-11-19T20:42:31Z"
        },
        {
          "SHA256Fingerprint": "3403d75002d22e2b8c49a8a113957d9eb225c901b946837fd61ff3ce32c51f65",
          "issuedTo": "CN=Microsoft Public RSA Time Stamping Authority,OU=Microsoft America Operations+OU=Thales TSS ESN:45D6-96C5-5E63,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US",
          "issuedBy": "CN=Microsoft Public RSA Timestamping CA 2020,O=Microsoft Corporation,C=US",
          "expiry": "2025-02-15T20:35:56Z"
        }
      ]
    }
  },
  "certificates": [
    {
      "SHA256Fingerprint": "3678adce9daa3a82f4f55fd65e0c87c398b3d9bcd5338c06bbf8850df8c6641d",
      "issuedTo": "CN=testcert3,O=Notary,L=Seattle,ST=WA,C=US",
      "issuedBy": "CN=testcert3,O=Notary,L=Seattle,ST=WA,C=US",
      "expiry": "2025-01-08T08:42:24Z"
    }
  ],
  "signedArtifact": {
    "mediaType": "application/octet-stream",
    "digest": "sha256:c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
    "size": 11357
  }
}

@JeyJeyGao JeyJeyGao changed the title fix: blob inspect command prototype feat: blob inspect command prototype Jan 2, 2025
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 86.29630% with 37 lines in your changes missing coverage. Please review.

Project coverage is 76.37%. Comparing base (4808e08) to head (5be5665).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...n/internal/display/metadata/tree/inspect_helper.go 85.05% 9 Missing and 4 partials ⚠️
...n/internal/display/metadata/json/inspect_helper.go 87.20% 8 Missing and 3 partials ⚠️
cmd/notation/blob/inspect.go 93.87% 2 Missing and 1 partial ⚠️
...ion/internal/display/metadata/json/blob_inspect.go 78.57% 2 Missing and 1 partial ⚠️
...ion/internal/display/metadata/tree/blob_inspect.go 76.92% 2 Missing and 1 partial ⚠️
...notation/internal/display/metadata/tree/inspect.go 57.14% 2 Missing and 1 partial ⚠️
cmd/notation/inspect.go 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1133      +/-   ##
==========================================
+ Coverage   76.10%   76.37%   +0.27%     
==========================================
  Files          64       69       +5     
  Lines        3519     3610      +91     
==========================================
+ Hits         2678     2757      +79     
- Misses        646      654       +8     
- Partials      195      199       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JeyJeyGao JeyJeyGao changed the title feat: blob inspect command prototype feat: blob inspect command Jan 8, 2025
@JeyJeyGao JeyJeyGao marked this pull request as ready for review January 8, 2025 06:15
Copy link

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should be reviewed and merged after PR: #1128

@JeyJeyGao JeyJeyGao requested a review from Two-Hearts January 14, 2025 09:24
@JeyJeyGao
Copy link
Contributor Author

This PR should be reviewed and merged after PR: #1128

Unblocked now.

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss offline for the design first.

I'd like to refactor notation and adopt the same rendering model as oras.

@JeyJeyGao JeyJeyGao marked this pull request as draft January 21, 2025 03:23
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
@JeyJeyGao JeyJeyGao marked this pull request as ready for review February 12, 2025 08:20
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
shizhMSFT
shizhMSFT previously approved these changes Feb 13, 2025
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Two-Hearts
Two-Hearts previously approved these changes Feb 14, 2025
Copy link

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JeyJeyGao JeyJeyGao merged commit b0ef8b6 into notaryproject:main Feb 16, 2025
7 checks passed
@JeyJeyGao JeyJeyGao deleted the feat/blob_inspect branch February 16, 2025 01:17
7h3-3mp7y-m4n pushed a commit to 7h3-3mp7y-m4n/notation that referenced this pull request Mar 29, 2025
FeynmanZhou pushed a commit to FeynmanZhou/notation that referenced this pull request May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants